import React from 'react';
import ReactDOM from 'react-dom/client';
import { createBrowserRouter,RouterProvider } from 'react-router-dom'; 
import './index.css';
import About from './pages/About';
import Cart from './pages/Cart';
import Contact from './pages/Contact';
import Home from './pages/Home';
import Login from './pages/Login';
import News from './pages/News';
import NewsDetails from './pages/NewsDetails';
import NotFound from './pages/NotFound';
import Product from './pages/Product';
import ProductDetails from './pages/ProductDetails';
import Register from './pages/Register';

// 创建路由器对象,其中包含着一个路由列表,其中包含着若干路由
let router = createBrowserRouter([
  // 首页
  {path:'/',element:<Home/>},
  // 关于我们
  {path:'/about',element:<About></About>},
  // 购物车
  {path:'/cart',element:<Cart></Cart>},
  // 联系我们
  {path:'/contact',element:<Contact></Contact>},
  // 登录
  {path:'/login',element:<Login></Login>},
  // 注册
  {path:'/reg',element:<Register></Register>},
  // 新闻
  {path:'/news',element:<News></News>},
  // 新闻列表
  {path:'/news_details',element:<NewsDetails></NewsDetails>},
  // 产品详情
  {path:'/pro_details',element:<ProductDetails></ProductDetails>},
  // 产品
  {path:'/product',element:<Product></Product>},
  // 404 /* 通用地址
  {path:'/*',element:<NotFound></NotFound>},
])

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <RouterProvider router={router}/>
);


